#include <iostream>
#include <cmath>
using namespace std;
typedef long long LL;
#define endl '\n'
const int N = 410;
const int MOD = 1e9 + 7;
LL a[N][N * 2];
int n;

LL qpow(LL a, LL b, LL MOD)
{
    LL ret = 1;
    while(b)
    {
        if(b & 1) ret = ret * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return ret;
}

int guass()
{
    for(int i = 1; i <= n; i++)
    {
        int aim = i;
        for(int j = 1; j <= n; j++)
        {
            if(j < i && a[j][j] != 0) continue;
            if(a[j][i] > a[aim][i]) aim = j;
        }

        if(a[aim][i] == 0) return 0;

        for(int j = 1; j <= 2 * n; j++) swap(a[i][j], a[aim][j]);

        LL t = qpow(a[i][i], MOD - 2, MOD);

        for(int j = i; j <= 2 * n; j++) a[i][j] = a[i][j] * t % MOD;

        for(int j = 1; j <= n; j++)
        {
            if(j == i) continue;
            t = a[j][i];
            for(int k = i; k <= 2 * n; k++)
            {
                a[j][k] -= a[i][k] * t;
                a[j][k] = (a[j][k] % MOD + MOD) % MOD;
            }
        }
    }
    return 1;
}

void solve() 
{
    cin >> n;
    for(int i = 1; i <= n; i++) 
    {
        for(int j = 1; j <= n; j++)
        {
            cin >> a[i][j];
        }
    }
    for(int i = 1; i <= n; i++) a[i][i + n] = 1;
    int ret = guass();
    if(ret != 1) cout << "No Solution" << endl;
    else 
    {
        for(int i = 1; i <= n; i++)
        {
            for(int j = n + 1; j <= n * 2; j++) 
            {
                cout << a[i][j] << " ";
            }
            cout << endl;
        }
    }
}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int T = 1;
	// cin >> T;
	while(T--)
	{
        solve();
	}
	return 0;
}